home *** CD-ROM | disk | FTP | other *** search
/ El Mac 9 / El Mac 9.iso / Shareware / Applications / MathPad 2.4 / XFuns / fft / fft.rsrc / TEXT_131_pwrspec().txt < prev    next >
Encoding:
Text File  |  1996-03-06  |  604 b   |  17 lines

  1. --------------- pwrspec(R)
  2. -- returns a power spectrum estimate of the real array R in the global array "transform". This routine multiplies R by a cosine window to reduce frequency spread. The output is scaled so that the sum over all frequencies is an estimate of the mean squared amplitude of the input.
  3.  
  4. r(t) = t*f-trunc(t*f)-.5  -- example function (sawtooth wave)
  5.  
  6. R[i] = r(dt*(i-1)) dim[n] -- sample the function
  7. n=128;     f=8;      dt=1/n
  8.  
  9. Xmin=0; Xmax=dt*(n-1); Xsteps=300; Xlabel="secs"
  10. plot r(X)
  11. plot R
  12.  
  13. newaxis
  14. Xmin:=0:; Xmax:=1/(2*dt):; Xdiv=8; Xlabel:="Hz":
  15. pwrspec(R):
  16. plotline transform
  17.